/*
 * Copyright (C) 2009 Rob Cash
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * WizardModelEvent.java
 * 
 * Created on Jan 1, 2009 at 11:06:19 PM
 */

package org.robcash.commons.swing.wizard.event;

import java.util.EventObject;
import org.robcash.commons.swing.wizard.WizardPanel;
import org.robcash.commons.swing.wizard.model.WizardModel;

/**
 *
 * @author Rob
 */
public class WizardModelEvent extends EventObject {

    /**
     * Wizard panel added or removed
     */
    private WizardPanel panel;

    /**
     * Create a new wizard model event
     * @param model Wizard model that originated the event
     */
    public WizardModelEvent(WizardModel model) {
        super(model);
    }

    /**
     * Create a new wizard model event
     * @param model Wizard model that originated the event
     * @param panel Wizard panel added or removed from the model
     */
    public WizardModelEvent(WizardModel model, WizardPanel panel) {
        this(model);
        setPanel(panel);
    }

    /**
     * Get the model associated with this event
     * @return Wizard model that originated the event
     */
    public WizardModel getModel() {
        return (WizardModel) getSource();
    }
    
    /**
     * Get the wizard panel associated with this event
     * @return Wizard panel added or removed from the model
     */
    public WizardPanel getPanel() {
        return panel;
    }

    /**
     * Set the wizard panel associated with this event
     * @param panel Wizard panel added or removed from the model
     */
    protected void setPanel(WizardPanel panel) {
        this.panel = panel;
    }

}
